import { defineStore } from 'pinia'
import { settingStore } from '@/stores/setting.js'
const TOKEN_KEY = 'token'

export const useAppStore = defineStore('app', () => {
  const router = useRouter()
  const settingStores = settingStore()
  const menuIndex = ref(0)
  const moduleIndex = ref(0)
  // 跳转指定路由
  const selectMenu = (item, index) => {
    // menuIndex.value = index
    if (item.value != 'setting') {
      router.replace(item.value)
    } else {
      settingStores.showdialog = true
    }

  }
  const selectModule = (item, index) => {
    moduleIndex.value = index
  }
  return {
    menuIndex,
    moduleIndex,

    selectMenu,
    selectModule,
  }
})
